Eclipse Platform
Pre-release 3.0

org.eclipse.team.core.subscribers
Class SyncInfo

java.lang.Object
  extended byorg.eclipse.team.core.subscribers.SyncInfo
All Implemented Interfaces:
IAdaptable

public class SyncInfo
extends Object
implements IAdaptable

Describes the relative synchronization of a remote resource and a local resource using a base resource for comparison.

Differences between the base and local resources are classified as outgoing changes; if there is a difference, the local resource is considered the outgoing resource.

Differences between the base and remote resources are classified as incoming changes; if there is a difference, the remote resource is considered the incoming resource.

Differences between the local and remote resources determine the sync status. The sync status does not take into account the common resource.

Note that under this parse of the world, a resource can have both incoming and outgoing changes at the same time, but may nevertheless be in sync!

[Issue: "Gender changes" are also an interesting aspect... ]


Field Summary
static int ADDITION
          Sync constant (value 1) indicating that one side was added.
static int AUTOMERGE_CONFLICT
          Sync constant (value 32) indicating that both the local and remote resources have changed relative to the base but their content changes do not conflict (e.g.
static int CHANGE
          Sync constant (value 3) indicating that one side was changed.
static int CHANGE_MASK
          Bit mask for extracting the change type.
static int CONFLICTING
          Sync constant (value 12) indicating a change to both the remote and local resources.
static int DELETION
          Sync constant (value 2) indicating that one side was deleted.
static int DIRECTION_MASK
          Bit mask for extracting the synchronization direction.
static int IN_SYNC
          Sync constant (value 0) indicating element is in sync.
static int INCOMING
          Sync constant (value 8) indicating a change to the remote resource.
static int MANUAL_CONFLICT
          Sync constant (value 64) indicating that both the local and remote resources have changed relative to the base and their content changes conflict (e.g.
static int OUTGOING
          Sync constant (value 4) indicating a change to the local resource.
static int PSEUDO_CONFLICT
          Sync constant (value 16) indication that both the local and remote resources have changed relative to the base but their contents are the same.
 
Constructor Summary
SyncInfo(IResource local, IRemoteResource base, IRemoteResource remote, TeamSubscriber subscriber, IProgressMonitor monitor)
          Construct a sync info object.
 
Method Summary
protected  int calculateKind(IProgressMonitor progress)
           
 boolean equals(Object other)
           
 Object getAdapter(Class adapter)
          Returns an object which is an instance of the given class associated with this object.
 IRemoteResource getBase()
          Returns the remote resource handle for the base resource, or null if the base resource does not exist.
static int getChange(int kind)
           
static int getDirection(int kind)
           
 int getKind()
          Returns the kind of synchronization for this node.
 IResource getLocal()
          Returns the state of the local resource.
 String getLocalContentIdentifier()
          Returns the content identifier for the local resource or null if it doesn't have one.
 IRemoteResource getRemote()
          Returns the handle for the remote resource, or null if the remote resource does not exist.
 TeamSubscriber getSubscriber()
          Returns the subscriber that created and maintains this sync info object.
static boolean isInSync(int kind)
           
static String kindToString(int kind)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

IN_SYNC

public static final int IN_SYNC
Sync constant (value 0) indicating element is in sync.

See Also:
Constant Field Values

ADDITION

public static final int ADDITION
Sync constant (value 1) indicating that one side was added.

See Also:
Constant Field Values

DELETION

public static final int DELETION
Sync constant (value 2) indicating that one side was deleted.

See Also:
Constant Field Values

CHANGE

public static final int CHANGE
Sync constant (value 3) indicating that one side was changed.

See Also:
Constant Field Values

CHANGE_MASK

public static final int CHANGE_MASK
Bit mask for extracting the change type.

See Also:
Constant Field Values

OUTGOING

public static final int OUTGOING
Sync constant (value 4) indicating a change to the local resource.

See Also:
Constant Field Values

INCOMING

public static final int INCOMING
Sync constant (value 8) indicating a change to the remote resource.

See Also:
Constant Field Values

CONFLICTING

public static final int CONFLICTING
Sync constant (value 12) indicating a change to both the remote and local resources.

See Also:
Constant Field Values

DIRECTION_MASK

public static final int DIRECTION_MASK
Bit mask for extracting the synchronization direction.

See Also:
Constant Field Values

PSEUDO_CONFLICT

public static final int PSEUDO_CONFLICT
Sync constant (value 16) indication that both the local and remote resources have changed relative to the base but their contents are the same.

See Also:
Constant Field Values

AUTOMERGE_CONFLICT

public static final int AUTOMERGE_CONFLICT
Sync constant (value 32) indicating that both the local and remote resources have changed relative to the base but their content changes do not conflict (e.g. source file changes on different lines). These conflicts could be merged automatically.

See Also:
Constant Field Values

MANUAL_CONFLICT

public static final int MANUAL_CONFLICT
Sync constant (value 64) indicating that both the local and remote resources have changed relative to the base and their content changes conflict (e.g. local and remote resource have changes on same lines). These conflicts can only be correctly resolved by the user.

See Also:
Constant Field Values
Constructor Detail

SyncInfo

public SyncInfo(IResource local,
                IRemoteResource base,
                IRemoteResource remote,
                TeamSubscriber subscriber,
                IProgressMonitor monitor)
         throws TeamException
Construct a sync info object.

Method Detail

getLocal

public IResource getLocal()
Returns the state of the local resource. Note that the resource may or may not exist.

Returns:
a resource

getLocalContentIdentifier

public String getLocalContentIdentifier()
Returns the content identifier for the local resource or null if it doesn't have one. For example, in CVS this would be the revision number.

Returns:
String that could be displayed to the user to identify this resource.

getBase

public IRemoteResource getBase()
Returns the remote resource handle for the base resource, or null if the base resource does not exist.

[Note: The type of the common resource may be different from the types of the local and remote resources. ]

Returns:
a remote resource handle, or null

getRemote

public IRemoteResource getRemote()
Returns the handle for the remote resource, or null if the remote resource does not exist.

[Note: The type of the remote resource may be different from the types of the local and common resources. ]

Returns:
a remote resource handle, or null

getSubscriber

public TeamSubscriber getSubscriber()
Returns the subscriber that created and maintains this sync info object.


getKind

public int getKind()
Returns the kind of synchronization for this node.

Returns:

isInSync

public static boolean isInSync(int kind)

getDirection

public static int getDirection(int kind)

getChange

public static int getChange(int kind)

equals

public boolean equals(Object other)

getAdapter

public Object getAdapter(Class adapter)
Description copied from interface: IAdaptable
Returns an object which is an instance of the given class associated with this object. Returns null if no such object can be found.

Specified by:
getAdapter in interface IAdaptable
Parameters:
adapter - the adapter class to look up
Returns:
a object castable to the given class, or null if this object does not have an adapter for the given class

toString

public String toString()

kindToString

public static String kindToString(int kind)

calculateKind

protected int calculateKind(IProgressMonitor progress)
                     throws TeamException
Throws:
TeamException

Eclipse Platform
Pre-release 3.0

Copyright (c) IBM Corp. and others 2000, 2003. All Rights Reserved.